<?php

class Application_Form_ProjectSummary extends Zend_Form
{
    private $_nama;
    private $_status;
    
    public function getNama()
    {
        $this->_nama = new Application_Model_Pegawai();
        $result = $this->_nama->getAllData();
        $i=array();
        $i[''] = '';
        foreach($result as $result)
        {
            $i[$result['id_pegawai']] = $result['nama_pegawai'];
        }
        return $i;
    }
    
    public function  getStatus()
    {
        $this->_status = new Application_Model_StatusProyek();
        $result = $this->_status->getAllStatus();
        $i = array();
        $i[''] = '';
        foreach ($result as $result)
        {
            $i[$result['id_status_proyek']] = $result['status_proyek'];
        }
        return $i;
    }


    public function init()
    {
        $nama_project = new Zend_Form_Element_Text('nama_proyek');
        $nama_project->setLabel('Project Name')->setRequired();
        
        $tanggal_mulai = new ZendX_JQuery_Form_Element_DatePicker('tanggal_mulai');
        $tanggal_mulai->setAttrib('disabled', true);
        $tanggal_mulai->setLabel('Start Date')->addValidator('Date')->setJQueryParams(array('dateFormat' => 'yy-mm-dd', 'showAnim' => 'fadeIn','minDate' => '1', 'showOn' => 'button','buttonImage' => '/aventurine_project/content/images/calendar.gif', 'buttonImageOnly' => true))->setRequired();

        $tanggal_selesai = new ZendX_JQuery_Form_Element_DatePicker('tanggal_selesai');
        $tanggal_selesai->setAttrib('disabled', true);
        $tanggal_selesai->setLabel('End Date')->addValidator('Date')->setJQueryParams(array('dateFormat' => 'yy-mm-dd', 'showAnim' => 'fadeIn','minDate' => '7', 'showOn' => 'button','buttonImage' => '/aventurine_project/content/images/calendar.gif', 'buttonImageOnly' => true))->setRequired();
    
        $progress_proyek = new Zend_Form_Element_Text('progress_proyek');
        $progress_proyek->setLabel('Progress Proyek')->setAttrib('disabled', true)->setValue('0.00 %');
        
        $manager_proyek = new Zend_Form_Element_Select('id_manager');
        $manager_proyek->setLabel('Project Manager')->setMultiOptions($this->getNama())->setRequired();
        
        $status_proyek = new Zend_Form_Element_Select('id_status_proyek');
        $status_proyek->setLabel('Project Status')->setMultiOptions($this->getStatus())->setRequired();
        
        $this->addElements(array($nama_project, $tanggal_mulai, $tanggal_selesai, $manager_proyek, $status_proyek));
    }


}

